package javabase.schoolwork.day6_14;

import java.io.IOException;
import java.io.PipedInputStream;

/**
 * @author fance
 * @date 2018/6/14 22:49
 */
public class ReadData {
    public void read(PipedInputStream in) {
        try {
            System.out.println("read : ");
            byte[] byteArr = new byte[20];
            int len = in.read(byteArr);
            while (len != -1) {
                String s = new String(byteArr,0,len);
                System.out.println(s);
                len = in.read(byteArr);
            }
            System.out.println();
            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
